fix(server): serve only the current content address on the versioned hydration path - #3807
Conversation
The versioned hydration runtime URL (/_veryfront/hydration-runtime.<hash>.js) is cached as immutable, but ProdHydrationModuleHandler accepted any well-formed hash and answered with current-runtime bytes, so a previously issued URL could silently change content after a runtime upgrade (veryfront/veryfront-issue-inbox#276, incident #264). The handler now serves a versioned path only when its hash segment matches the content hash of the current runtime bundle; any other hash gets a non-cacheable 404 (checked before ETag revalidation, HEAD agrees with GET). Callers recover via the canonical unversioned path or by re-fetching the document, whose SSR output always embeds the current hash. Per the recorded decision, release-baked hydration runtimes are issue #277's scope; this change covers only the globally served current-runtime paths.
|
Warning Review limit reached
Next review available in: 19 minutes Limit details: You’ve used all 3 included reviews currently available under your plan. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f765c8d06f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
@coderabbitai review |
|
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
The versioned hydration runtime URL (
/_veryfront/hydration-runtime.<hash>.js) uses immutable caching, but the dynamic handler accepted any well-formed hash and returned the current runtime bytes. That broke the content-addressing contract. A first attempt rejected every non-current hash before release-baked assets could be served.Fix
The dynamic handler serves only the current content address. Non-current hashes fall through to
StaticHandler, which serves the exact release-baked asset fromdistwhen present. If the stored asset is absent, the static layer returns the final non-cacheable 404. GET, HEAD, and ETag behavior follow the same ownership boundary.Testing
deno test --preload=src/testing/preload.ts --no-check --allow-all src/server/handlers/request/prod-hydration-module.handler.test.ts src/server/handlers/request/static.handler.test.ts src/server/services/static/static-file.service.test.ts, 3 tests with 53 steps.deno fmt --check src/server/handlers/request/prod-hydration-module.handler.ts src/server/handlers/request/prod-hydration-module.handler.test.tsdeno lint src/server/handlers/request/prod-hydration-module.handler.ts src/server/handlers/request/prod-hydration-module.handler.test.tsdeno check src/server/handlers/request/prod-hydration-module.handler.ts src/server/handlers/request/prod-hydration-module.handler.test.tsgit diff --checkCloses veryfront/veryfront-issue-inbox#276